# _*_ encoding:utf-8 _*_

from rest_framework import serializers

from .models import Question, Reply
from user.models import User


class UserModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = User
        fields = [
            'id',
            'username',
            'avatar'
        ]


class ReplyModelSerializer(serializers.ModelSerializer):
    user = UserModelSerializer()

    class Meta:
        model = Reply
        fields = '__all__'


class QuestionModelSerializer(serializers.ModelSerializer):
    labels = serializers.StringRelatedField(many=True)

    class Meta:
        model = Question
        fields = '__all__'


